package com.qf.stu.application.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.stu.application.dao.StuDao;
import com.qf.stu.application.entity.Stu;
import com.qf.stu.application.feign.ClsRemote;
import com.qf.stu.application.service.StuService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * (Stu)表服务实现类
 *
 * @author makejava
 * @since 2024-01-27 14:14:15
 */
@Service("stuService")
@Transactional
public class StuServiceImpl extends ServiceImpl<StuDao, Stu> implements StuService {

    @Autowired
    private ClsRemote clsRemote;

    @Override
    @GlobalTransactional
    public boolean save(Stu entity) {
        //保存学生
        super.save(entity);

        //保存班级
        clsRemote.insert();

        //报错
        System.out.println(1/0);
        return true;
    }
}

